![]() |
GetNewControl |
||||
Header: | Controls.h | Carbon status: | Supported | |
Creates a control from a control resource.
ControlRef GetNewControl ( SInt16 resourceID, WindowRef owningWindow );
The resource ID of the control you wish to create.
A pointer to the window in which to place the control.
A handle to the control created from the specified control resource. If GetNewControl can’t read the control resource from the resource file, it returns NULL.
The GetNewControl function creates a control structure from the information in the specified control resource, adds the control structure to the control list for the specified window, and returns as its function result a handle to the control. You use this handle when referring to the control in most other Control Manager functions. After making a copy of the control resource, GetNewControl releases the memory occupied by the original control resource before returning.
The control resource specifies the rectangle for the control, its initial setting, its visibility state, its maximum and minimum settings, its control definition ID, a reference value, and its title (if any). After you use GetNewControl to create the control, you can change the control characteristics with other Control Manager functions.
If the control resource specifies that the control should be visible, the Control Manager draws the control. If the control resource specifies that the control should initially be invisible, you can use the function ShowControl to make the control visible.
When an embedding hierarchy is established within a window, GetNewControl automatically embeds the newly created control in the root control of the owning window.
Supported in Carbon. Available in Mac OS 8.1 and later when Carbon 1.0.2 or later is present.
© 2000 Apple Computer, Inc. — (Last Updated 5/8/2000)